package net.joey.httpclient.youku.utils;

import net.sf.json.JSONObject;


public class JsonUtils {

	
	public static Object get(JSONObject json,String key){
		String[] keys = key.split("\\.");
		if(null != keys){
			for(int i = 0;i<keys.length;i++){
				if(i != keys.length - 1 ){
					Object o = json.get(keys[i]);
					if(null != o){
						json = (JSONObject) o;
					}else{
						return null;
					}
				}else{
					return json.get(keys[i]);
				}
			}
		}
		return null;
	}
	
}
